const mongoose = require('mongoose');
const config = require('./config');
const { DBHOST, DBPORT, DBNAME } = config;

mongoose.connect(`mongodb://${DBHOST}:${DBPORT}/${DBNAME}`);

mongoose.set('strictQuery', true);

mongoose.connection.once('open', () => {
    console.log('数据库连接');
});

mongoose.connection.once('close', () => {
    console.log('数据库关闭');
});
